package com.jwdf.uda.http.action;

import android.content.Context;

import com.jwdf.uda.bean.PbBean;
import com.jwdf.uda.http.AHttpService;
import com.jwdf.uda.http.ApiService;

import retrofit2.Call;

/**
 * 类说明：
 * 作者：huangqiuxin on 2016/5/14 14:32
 * 邮箱：648859026@qq.com
 */
public class GuideDetailAction extends AHttpService<PbBean.PbResGuideDetail> {
    /**
     * 搭配指导详情
     *
     * @param context
     * @param id      搭配指导ID
     * @return
     */

    public static GuideDetailAction newInstance(Context context, int id) {
        return new GuideDetailAction(context, id);
    }

    public static GuideDetailAction newInstance(Context context, int id, PbBean.PbSignInteractionListSortType sort) {
        return new GuideDetailAction(context, id, sort);
    }

    private int id;
    private PbBean.PbSignInteractionListSortType sort;

    private GuideDetailAction(Context context, int id) {
        super(context);
        this.id = id;
    }

    private GuideDetailAction(Context context, int id, PbBean.PbSignInteractionListSortType sort) {
        this(context, id);
        this.sort = sort;
    }

    @Override
    protected Call newRetrofitCall(ApiService apiService, PbBean.PbBaseClientInfo.Builder baseBuilder) {
        PbBean.PbReqGuideDetail.Builder builder = PbBean.PbReqGuideDetail.newBuilder();
        builder.setBaseClientInfo(baseBuilder);
        builder.setId(id);
        if (sort != null) {
            builder.setSortType(sort);
        }
        return apiService.guideDetail(builder.build());
    }
}
